package EvaTCPL;

public class EvaTCPLvarvalue extends EvaTCPLaexpression
{
  String identifier;
  int timestep = 0;
  EvaTCPLVariable var;

  public EvaTCPLvarvalue(String theidentifier, int thetimestep)
    {
      identifier = theidentifier;
      timestep = thetimestep;
    }
  
  /** Evaluate this arithmetic expression. */
  public double evaluate()
    {
      return var.getEStoreRealValue(timestep);
    }
  
  /** Evaluate this arithmetic expression as an integer. */
  public int evaluateint()
    {
      return var.getEStoreIntValue(timestep);
    }
  
  /** Convert expression to a string. */
  public String toString()
    {
      return identifier+"["+timestep+"]";
    }
  
  public void initialize_inner(EvaTCPLProblem theproblem)
    {
      var = theproblem.findVariable(identifier);
    }
  
}
